﻿using System;
using System.Collections.Generic;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace SL4_NAV_ProjectiCON.Views
{
    public class MonthlyActivity
    {
        #region Private Fields

        private static Random randomizer = new Random(DateTime.Now.Millisecond);

        #endregion Private Fields

        #region Properties

        public int Activities
        { get; set; }

        public decimal TotalActivity
        { get; set; }

        public List<DepotActivity> DepotActivity
        { get; set; }

        #endregion Properties

        #region Public Static Methods

        public static List<MonthlyActivity> GetAll()
        {
            List<MonthlyActivity> data = new List<MonthlyActivity>();

            // Generate some artificial sales foreach month
            for (int i = 1; i <= 4; i++)
            {
                MonthlyActivity activity = new MonthlyActivity();
                activity.Activities = i;
                activity.DepotActivity = new List<DepotActivity>();

                decimal randomAmount1 = GenerateRandomAmount();
                DepotActivity Gateinactivity = new DepotActivity(Depot.GENERAL_PURPOSE , i, randomAmount1);
                activity.DepotActivity.Add(Gateinactivity);

                decimal randomAmount2 = GenerateRandomAmount();
                DepotActivity Estimateactivity = new DepotActivity(Depot.TANK, i, randomAmount2);
                activity.DepotActivity.Add(Estimateactivity);

                decimal randomAmount3 = GenerateRandomAmount();
                DepotActivity AVactivity = new DepotActivity(Depot.OPEN_TOP , i, randomAmount3);
                activity.DepotActivity.Add(AVactivity);

                decimal randomAmount4 = GenerateRandomAmount();
                DepotActivity Gateoutactivity = new DepotActivity(Depot.REEFER, i, randomAmount4);
                activity.DepotActivity.Add(Gateoutactivity);

                activity.TotalActivity = randomAmount1 + randomAmount2 + randomAmount3 + randomAmount4;
                data.Add(activity);
            }

            return data;
        }

        #endregion Public Static Methods

        #region Private Static Methods

        private static decimal GenerateRandomAmount()
        {
            // Randomly generate a price
            double random = randomizer.NextDouble();
            decimal amount = Convert.ToDecimal(random * 10000);

            return amount;
        }

        #endregion Private Static Methods
    }

    public class DepotActivity
    {
        #region Private Fields

        private static Random randomizer = new Random(DateTime.Now.Millisecond);

        #endregion Private Fields

        #region Properties

        public Depot Depot
        { get; set; }

        public int MonthActivity
        { get; set; }

        public decimal TotalActivity
        { get; set; }

        #endregion Properties

        #region Constructors

        public DepotActivity(Depot Depot, int monthNumber, decimal amount)
        {
            this.Depot = Depot;
            this.MonthActivity = monthNumber;
            this.TotalActivity = amount;
        }

        #endregion Constructors
    }

    public enum Depot
    {
        GENERAL_PURPOSE = 0,

        TANK = 1,

        REEFER = 2,

        HIGH_CUBE = 3,

        OPEN_TOP=4

    }
}
